


from flask import Flask,render_template,request,abort
app = Flask(__name__)

@app.route('/index',methods=['GET','POST'])
def index():
    if request.method == 'GET':
        return render_template('index.html')
    if request.method == 'POST':
        name = request.form.get('name')
        passwd = request.form.get('password')
        print(name,passwd)
        if name == '123' and passwd == '123':
            return 'success'
        else:
            abort(404)
            return None



#自定义错误处理
@app.errorhandler(404)
def handle_404_error(err):
    return render_template('404.html')


if __name__ == '__main__':
    app.run()
